<%--
  Created by IntelliJ IDEA.
  User: ASUS
  Date: 2020/12/28
  Time: 17:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>
<html lang="en">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <title>media list</title>
</head>

<body>
<h1 class="text-center pt-3 pb-3">修改影片</h1>

<div class="container">
    <hr>
    <form action="/set_movie.action" method="post" target="_blank">
        <input type="hidden" class="form-control" name="id" value="${movie.id}">
        <div class="form-group row">
            <h4 class="offset-md-3 col-md-2 text-right">影片名称：</h4>
            <div class="col-md-4">
                <input type="text" class="form-control" id="inputUsername" name="name" value="${movie.name}" placeholder="">
            </div>
        </div>
        <div class="form-group row">
            <h4 class="offset-md-3 col-md-2 text-right">影片票价：</h4>
            <div class="col-md-4">
                <input type="text" class="form-control" id="inputUserprice" name="price" value="${movie.price}" placeholder="">
            </div>
        </div>
        <div class="form-group row">
            <h4 class="offset-md-3 col-md-2 text-right">国家地区：</h4>
            <div class="col-md-4">
                <select class="form-control" id="sel1" name="country.countryId">
                    <c:forEach items="${countries}" var="a">
                        <option value="${a.countryId}" ${a.countryId == movie.country.countryId ? "selected" : "" }>${a.countryName}</option>
                    </c:forEach>
                </select>
            </div>
        </div>
        <div class="form-group row">
            <h4 class="offset-md-3 col-md-2 text-right">分类名称：</h4>
            <div class="col-md-4 row" style="font-size:16px; font-weight:lighter;">
                <c:forEach items="${categories}" var="c" varStatus="s">
                    <c:set var="status" value=""/>
                    <c:forEach items="${movie.categories}" var="m">
                        <c:if test="${m.categoryId == c.categoryId}">
                            <c:set var="status" value="checked"/>
                        </c:if>
                    </c:forEach>
                    <div class="col-md-4">
                        <input type="checkbox" name="categoryId" value="${c.categoryId}" ${status}> ${c.categoryName}
                    </div>
                </c:forEach>
            </div>
        </div>
        <div class="offset-md-5 col-md-4 text-left">
            <button type="submit" class="btn btn-primary">修改影片</button>
            <button type="button" class="btn btn-outline-primary">关闭窗口</button>
        </div>
    </form>
</div>
</body>
</html>